home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Pascal Super Library
/
Pascal Super Library (CW International)(1997).bin
/
BBS_UTL
/
LOGPAS17
/
LOGTEST.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1995-05-30
|
2KB
|
56 lines
Program LogTest; { Example use of LogDev (c) M.P.B. Cole 1991 }
USES Crt,LogDev;
CONST LogName = ''; {* STDOUT, put a filename here if you want *}
VAR Log: text; {* Log file, assigned to LogDev with AssignLOg() *}
LogLevel, {* Got from user *}
ScreenLevel: byte; { * " *}
LogType: LogTypes; { * " *}
ch: char;
begin
{* Loop until ESC pressed *}
repeat
writeln;
write('Log Type B)inkley, F)rontDoor, D)Bridge or ESC to stop ');
case UpCase(ReadKey) of
'B': LogType := Binkley;
'F': LogType := FrontDoor;
'D': LogType := DBridge;
#27: halt;
end;
write(#13#10'What log level (0 to 5) :');
readln(LogLevel);
writeln;
{* Intro string for FrontDoor and Binkley logs *}
LogDev_Intro := 'LogDev Demo.';
{* If null file name (=stdout) make screen level 0 to stop doubling *}
if LogName = '' then ScreenLevel := 0 else ScreenLevel := 5;
{* Open a log using LogDev *}
AssignLog(log,LogName,LogType,'LOGDEV',LogLevel,0);
append(Log);
if ioresult <> 0 then Rewrite(log); {* creates log and writes banner *}
{* Allow entry without flag to assume level of previous entry *}
LogDev_AssumeLastFlag := true; {* Default is FALSE *}
{* Write a selection entries at different levels *}
writeln(log,'1Here is a serious error'); {* All levels > 0 }
writeln(log,'Entry with no level flag'); {* Same as last if AssumeLastFlag }
writeln(log,'2Important entry.'); {* 2 and above }
writeln(log,'3Non crucial entry.'); {* 3 and above }
writeln(log,'Another with no level, defaults to 3.');
writeln(log,'4Simple progress message'); {* 4 and above }
writeln(log,'5Pure screen fodder'); {* 5 only }
close(log); {* Writes 'End,' if Binkley}
until false;
end.